package ch01;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/bbs-post")
public class BBSPostServlet extends HttpServlet { 
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String name= request.getParameter("name");
		String title = request.getParameter("title");
		String content = request.getParameter("content");
		
		response.setContentType("text/html;charset=utf-8");
		java.io.PrintWriter out = response.getWriter();
		out.println("<title>게시판 글쓰기 - 결과</title>");
		out.printf("이름: %s <br>",name);
		out.printf("제목: %s <br>",title);
		out.println("--------------------- <br>");
		out.printf("<pre>%s</pre>",content);
		out.println("--------------------- <br>");
		out.println("저장되었습니다.");		
	}
}










